package com.extrace.misc.model;

import com.google.gson.annotations.Expose;

import java.io.Serializable;
import java.util.Date;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "TransPackage")
public class TransPackage  implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 3050390478904210174L;

    public TransPackage() {
    }

    @Expose private String ID;
    @Expose private TransNode sourceNode;
    @Expose private TransNode targetNode;
    @Expose private Date createTime;
    @Expose private int status;

    public void setID(String value) {
        this.ID = value;
    }

    public String getID() {
        return ID;
    }

    public String getORMID() {
        return getID();
    }

    public void setSourceNode(TransNode value) {
        this.sourceNode = value;
    }

    public TransNode getSourceNode() {
        return sourceNode;
    }

    public void setTargetNode(TransNode value) {
        this.targetNode = value;
    }

    public TransNode getTargetNode() {
        return targetNode;
    }

    public void setCreateTime(Date value) {
        this.createTime = value;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setStatus(int value) {
        this.status = value;
    }

    public int getStatus() {
        return status;
    }

    public String toString() {
        return toString(false);
    }

    public String toString(boolean idOnly) {
        if (idOnly) {
            return String.valueOf(getID());
        }
        else {
            StringBuffer sb = new StringBuffer();
            sb.append("TransPackage[ ");
            sb.append("ID=").append(getID()).append(" ");
            if (getSourceNode() != null)
                sb.append("SourceNode.Persist_ID=").append(getSourceNode().toString(true)).append(" ");
            else
                sb.append("SourceNode=null ");
            if (getTargetNode() != null)
                sb.append("TargetNode.Persist_ID=").append(getTargetNode().toString(true)).append(" ");
            else
                sb.append("TargetNode=null ");
            sb.append("CreateTime=").append(getCreateTime()).append(" ");
            sb.append("Status=").append(getStatus()).append(" ");
            sb.append("]");
            return sb.toString();
        }
    }

    private boolean _saved = false;

    public void onSave() {
        _saved=true;
    }


    public void onLoad() {
        _saved=true;
    }


    public boolean isSaved() {
        return _saved;
    }

    public static final class STATUS{
        public static final int STATUS_CREATE = 0;
        public static final int STATUS_PACKAGING = 1;
        public static final int STATUS_TRANSPORT = 2;
        public static final int STATUS_SORT = 3;
        public static final int STATUS_LANSHOU_PACKAGE = 4;
        public static final int STATUS_DELIVER_PACKAGE = 5;
        public static final int STATUS_DESTROY = 6;
    }
}

